home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / GMS / GMSDev / Includes / dpkernel / dpkernel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-12  |  7.9 KB  |  271 lines

  1. #ifndef DPKERNEL_H
  2. #define DPKERNEL_H TRUE
  3.  
  4. /*
  5. **   $VER: dpkernel.h V1.0
  6. **
  7. **   General include file for programs using the dpkernel.
  8. **
  9. **   (C) Copyright 1996-1998 DreamWorld Productions.
  10. **       All Rights Reserved.
  11. */
  12.  
  13. #ifndef SYSTEM_TYPES_H
  14. #include <system/types.h>
  15. #endif
  16.  
  17. #ifndef SYSTEM_REGISTER_H
  18. #include <system/register.h>
  19. #endif
  20.  
  21. /***************************************************************************/
  22.  
  23. #define DPKVersion  1
  24. #define DPKRevision 0
  25.  
  26. #define   M68K_REGISTERS TRUE
  27. #define   M68K_CPU       TRUE
  28. #define   MACHINE_AMIGA  TRUE
  29. /*#define MACHINE_MAC    FALSE */
  30. /*#define MACHINE_IBMPC  TRUE  */
  31. /*#define PENTIUM_CPU    TRUE  */
  32. /*#define _USE_DPKBASE   TRUE  */
  33.  
  34. #ifdef __SASC
  35.   #define LIBPTR  __asm
  36.   #define LIBFUNC __asm __saveds
  37.   #define mreg(r) register r
  38.   #define FNCALL inline
  39. #else
  40.  #ifdef _DCC
  41.    #define LIBPTR
  42.    #define LIBFUNC
  43.    #define mreg(r) r
  44.    #define FNCALL inline
  45.  #else
  46.    #define LIBPTR
  47.    #define LIBFUNC
  48.    #define mreg(r)
  49.    #define FNCALL inline
  50.  #endif
  51. #endif
  52.  
  53. /****************************************************************************
  54. ** Tag definitions.
  55. */
  56.  
  57. #define SKIPENTRY   0
  58. #define ENDLIST     -1
  59. #define LISTEND     -1
  60. #define TAGEND      0
  61. #define DEFAULT     0
  62.  
  63. #define TBYTE       0L
  64. #define TLONG       (1L<<31)
  65. #define TWORD       (1L<<30)
  66. #define TAPTR       (1L<<29)|TLONG
  67. #define TSTEPIN     (1L<<28)
  68. #define TSTEPOUT    (1L<<27)
  69. #define TTRIGGER    (1L<<26)
  70.  
  71. #define TALLTAGS    (TBYTE|TLONG|TWORD|TAPTR|TSTEPIN|TSTEPOUT|TTRIGGER)
  72.  
  73. #ifndef TAG_IGNORE
  74.  #ifdef MACHINE_AMIGA
  75.   #include <utility/tagitem.h>
  76.  #else
  77.   typedef ULONG Tag;
  78.   struct TagItem {
  79.     Tag    ti_Tag;        /* Identifies the type of data */
  80.     ULONG ti_Data;       /* Type-specific data */
  81.   };
  82.  
  83.   #define TAG_IGNORE  (1L)
  84.   #define TAG_MORE    (2L)
  85.   #define TAG_SKIP    (3L)
  86.  #endif
  87. #endif /* TAG_IGNORE */
  88.  
  89. /****************************************************************************
  90. ** ID flags for Get().
  91. */
  92.  
  93. #define GET_NOTRACK (0x00010000L)
  94. #define GET_PUBLIC  (0x00020000L)
  95. #define GET_SHARE   ((0x00040000L)|GET_PUBLIC)
  96.  
  97. /****************************************************************************
  98. ** Function synonyms.
  99. */
  100.  
  101. #define DMsg(a)    DPrintF(NULL,a)
  102. #define EMsg(a)    DPrintF("Error:",a)
  103.  
  104. #define Display(a)   Show(a)
  105. #define Visible(a)   Show(a)
  106. #define Invisible(a) Hide(a)
  107.  
  108. /****************************************************************************
  109. ** Header used for all objects.
  110. */
  111.  
  112. struct Head {
  113.   WORD   ID;
  114.   WORD   Version;
  115.   struct SysObject *Class;
  116.   struct Stats     *Stats;
  117. };
  118.  
  119. /****************************************************************************
  120. ** The Stats structure is private to the system, and is handled by Get()
  121. */
  122.  
  123. struct Stats {
  124.   LONG Key;                  /* Resource tracking key */
  125.   APTR ChildPrivate;         /* Reserved pointer for use by child objects */
  126.   LONG Flags;                /* General flags */
  127.   struct DPKTask *Exclusive; /* Who owns the exclusive */
  128.   WORD LockCount;            /* A running count of active locks */
  129.   WORD emp;                  /* */
  130.   LONG MemFlags;             /* Recommended memory allocation flags */
  131. };
  132.  
  133. #define ST_SHARED      0x00000001L  /* The object is being openly shared */
  134. #define ST_EXCLUSIVE   0x00000002L  /* If the object is exclusive to a task */
  135. #define ST_PUBLIC      0x00000004L  /* If the object can be passed around */
  136. #define ST_NOTRACKING  0x00000008L  /* Do not track resources on this object */
  137. #define ST_INITIALISED 0x00000010L  /* This is set by Init() */
  138.  
  139. /****************************************************************************
  140. ** Raw Data object.
  141. */
  142.  
  143. #define VER_RAWDATA  1
  144. #define TAGS_RAWDATA ((ID_SPCTAGS<<16)|ID_RAWDATA)
  145.  
  146. struct RawData {
  147.   struct Head Head;  /* Standard structure header */
  148.   LONG   Size;       /* Size of the data in bytes */
  149.   APTR   Data;       /* Pointer to the data */
  150.  
  151.   /*** Private fields below ***/
  152.  
  153.   BYTE prvAFlags;    /* Private */
  154.   BYTE prvPad;       /* Private */
  155. };
  156.  
  157. /****************************************************************************
  158. ** List object.
  159. */
  160.  
  161. #define VER_ITEMLIST  1
  162. #define TAGS_ITEMLIST ((ID_SPCTAGS<<16)|ID_ITEMLIST)
  163.  
  164. struct ItemList {
  165.   struct Head Head;  /* Standard header */
  166.   APTR   *Array;     /* Pointer to the list's array, terminated with -1 */
  167.   LONG   MaxSize;    /* Maximum amount of objects that this list can hold */
  168.  
  169.   /*** Private fields below ***/
  170.  
  171.   APTR   prvMemory;
  172. };
  173.  
  174. /****************************************************************************
  175. ** Universal errorcodes returned by certain functions.
  176. */
  177.  
  178. #define ERR_OK           0  /* Function went OK (also NULL) */
  179. #define ERR_NOMEM        1  /* Not enough memory available */
  180. #define ERR_NOPTR        2  /* Required pointer not present */
  181. #define ERR_INUSE        3  /* Previous allocations have not been freed */
  182. #define ERR_STRUCT       4  /* Structure version not supported or not found */
  183. #define ERR_FAILED       5  /* General failure */
  184. #define ERR_FILE         6  /* File error, eg file not found */
  185. #define ERR_BADDATA      7  /* There is an error in the given data */
  186. #define ERR_SEARCH       8  /* A search routine in this function failed */
  187. #define ERR_SCRTYPE      9  /* Screen type not recognised */
  188. #define ERR_MODULE      10  /* Trouble initialising/using a module */
  189. #define ERR_RASTCOMMAND 11  /* Invalid raster command detected */
  190. #define ERR_RASTERLIST  12  /* Complete rasterlist failure */
  191. #define ERR_NORASTER    13  /* Expected rasterlist is missing from Screen */
  192. #define ERR_DISKFULL    14  /* Disk full error */
  193. #define ERR_FILEMISSING 15  /* File not found */
  194. #define ERR_WRONGVER    16  /* Wrong version or version not supported */
  195. #define ERR_MONITOR     17  /* Monitor driver not found or cannot be used */
  196. #define ERR_UNPACK      18  /* Problem with unpacking of data */
  197. #define ERR_ARGS        19  /* Invalid arguments passed to function */
  198. #define ERR_NODATA      20  /* No data is available for use */
  199. #define ERR_READ        21  /* Error reading data from file */
  200. #define ERR_WRITE       22  /* Error writing data to file */
  201. #define ERR_LOCK        23  /* Could not obtain lock on object */
  202. #define ERR_EXAMINE     24  /* Could not examine directory or file */
  203. #define ERR_LOSTCLASS   25  /* This object has lost its class reference */
  204. #define ERR_NOACTION    26  /* This object does not support the required action */
  205. #define ERR_NOSUPPORT   27  /* Object does not support the given data */
  206. #define ERR_MEMORY      28  /* General memory error */
  207. #define ERR_TIMEOUT     29  /* Function timed-out before successful completion */
  208. #define ERR_NOSTATS     30  /* This object has lost its stats structure */
  209.  
  210. /*** Synonyms ***/
  211.  
  212. #define ERR_SUCCESS   ERR_OK
  213. #define ERR_DATA      ERR_BADDATA
  214. #define ERR_LOSTSTATS ERR_NOSTATS
  215. #define ERR_NOCLASS   ERR_LOSTCLASS
  216.  
  217. /****************************************************************************
  218. ** Memory types used by AllocMemBlock().  This is generally identical to the
  219. ** exec definitions but CHIP is renamed to VIDEO (displayable memory) and
  220. ** there is an addition of BLIT and SOUND specific memory.
  221. */
  222.  
  223. #define MEM_DATA      0
  224. #define MEM_PUBLIC    (1L<<0)
  225. #define MEM_VIDEO     (1L<<1)
  226. #define MEM_BLIT      (1L<<2)
  227. #define MEM_SOUND     (1L<<3)
  228. #define MEM_CODE      (1L<<4)
  229. #define MEM_UNTRACKED (1L<<31)
  230.  
  231. #define MEM_AUDIO     MEM_SOUND
  232.  
  233. #define AllocPublic(size,flags) AllocMemBlock((size),(flags)|MEM_PUBLIC)
  234. #define AllocPrivate(size,flags) AllocMemBlock((size),(flags))
  235.  
  236. /***************************************************************************/
  237.  
  238. #ifndef SYSTEM_MISC_H
  239. #include <system/misc.h>
  240. #endif
  241.  
  242. #ifndef SYSTEM_MODULES_H
  243. #include <system/modules.h>
  244. #endif
  245.  
  246. #ifndef GRAPHICS_BLITTER_H
  247. #include <graphics/blitter.h>
  248. #endif
  249.  
  250. #ifndef GRAHICS_PICTURES_H
  251. #include <graphics/pictures.h>
  252. #endif
  253.  
  254. #ifndef GRAPHICS_SCREENS_H
  255. #include <graphics/screens.h>
  256. #endif
  257.  
  258. #ifndef INPUT_JOYPORTS_H
  259. #include <input/joyports.h>
  260. #endif
  261.  
  262. #ifndef SOUND_SOUND_H
  263. #include <sound/sound.h>
  264. #endif
  265.  
  266. #ifndef FILES_FILES_H
  267. #include <files/files.h>
  268. #endif
  269.  
  270. #endif /* DPKERNEL_H */
  271.